package com.oes.dao.impl;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import com.oes.dao.AnswerDao;
import com.oes.entity.AnswerSCP;
import com.oes.util.DBUtil;

public class AnswerDaoImpl implements AnswerDao{

	public int UpdateAnswer(int Aid ,int Score) {
		
		Connection conn = null;
		PreparedStatement ps = null;
		String sql = "update answer set Score = ? where Aid = ?";
		int sign = 0;
		
		conn = DBUtil.getConnection();
		try {
			
			ps = conn.prepareStatement(sql);
			ps.setInt(1, Score);
			ps.setInt(2, Aid);
			sign = ps.executeUpdate();
			
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} finally{
			DBUtil.close(ps);
			DBUtil.close(conn);
		}
		
		return sign;
	}

}
